cmake_minimum_required(VERSION 3.12)

project(PDFEditor)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(POPPLER_QT5 REQUIRED poppler-qt5)

file(GLOB_RECURSE SOURCES "src/*")
add_executable(${CMAKE_PROJECT_NAME} ${SOURCES})

# 把找到的包含目录和库添加到你的目标中
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${POPPLER_QT5_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${POPPLER_QT5_LIBRARIES})

# 添加这个是为了让编译器知道库文件的位置
#link_directories(${POPPLER_QT5_LIBRARY_DIRS})

# 链接库文件到你的目标
target_link_libraries(${CMAKE_PROJECT_NAME}
    Qt5::Widgets
    ${POPPLER_QT5_LIBRARY_DIRS})

